<script>
import PPMForm from "@/crm3.0part7-ppm/core/ppmForm.vue";
export default {
  name: "ctw11772",
  mixins: [PPMForm],
  data() {
    return {};
  },
  mounted() {
    this.init();
  },
  computed: {},
  methods: {
    //初始化
    init() {
      this.formData["10461702-100012749"].isshow = false;
      var cacheInfo = JSON.parse(localStorage.getItem("cacheInfo"));

      //节点名称
      this.formData["4691-141000044"].value = cacheInfo.nodeName;

      //填报期限
      // this.formData["4691-100012611"].value = cacheInfo.taskReqDate;
      this.formData["4691-100012611"].value = this.$util.dateFormat(
        cacheInfo.taskReqDate,
        "yyyy-MM-dd"
      );

      //填报日期
      this.formData["4691-100012440"].value = this.$util.dateFormat(
        new Date(),
        "yyyy-MM-dd"
      );
      //填报人
      this.formData["4691-100012377"].value = cacheInfo.staffName;

      //联系电话
      this.formData["4691-141000045"].value = cacheInfo.linkTel;
    },

    //长途中继资源
    source() {
      if (this.formData["4691-100013716"].value == "9005001") {
        this.SetRequired({
          attrName: "预计工期(工作日)",
          formkey: "4691-100013719",
          reqName: "empty",
          reqStatus: false,
        });
        if (this.formData["4691-100013717"].value == "9005001") {
          this.formData["4691-141000051"].text = "具备";
          this.formData["4691-141000051"].value = "9005001";
          this.SetRequired({
            attrName: "总预计工期(工作日)",
            formkey: "4691-100013712",
            reqName: "empty",
            reqStatus: false,
          });
        }
        this.formData["4691-100013719"].value = " ";
      }
      if (this.formData["4691-100013716"].value == "9005002") {
        this.formData["4691-141000051"].text = "不具备";
        this.formData["4691-141000051"].value = "9005002";
        this.SetRequired({
          attrName: "预计工期(工作日)",
          formkey: "4691-100013719",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "总预计工期(工作日)",
          formkey: "4691-100013712",
          reqName: "empty",
          reqStatus: true,
        });
      }
    },

    //长途中继资源预计工作日
    TIMELIMITA() {
      this.SetRequired({
        attrName: "预计工期(工作日)",
        formkey: "4691-100013719",
        reqName: "pinteger",
        reqStatus: true,
      });
      if (this.formData["4691-100013716"].value == "9005001") {
        if (this.formData["4691-100013719"].value > 20) {
          this.$alert("预计工作日不能超过20天!", "提示", {
            type: "warning",
            confirmButtonText: "关闭",
          });
          this.formData["4691-100013719"].value = "";
        }
      }
      if (this.formData["4691-100013716"].value == "9005002") {
        if (this.formData["4691-100013719"].value <= 20) {
          this.$alert("预计工作日需大于20天!", "提示", {
            type: "warning",
            confirmButtonText: "关闭",
          });
          this.formData["4691-100013719"].value = "";
        }
      }
    },

    //端口资源
    PortSource() {
      if (this.formData["4691-100013717"].value == "9005001") {
        this.SetRequired({
          attrName: "预计工期(工作日)",
          formkey: "4691-100013720",
          reqName: "empty",
          reqStatus: false,
        });
        if (this.formData["4691-100013716"].value == "9005001") {
          this.formData["4691-141000051"].text = "具备";
          this.formData["4691-141000051"].value = "9005001";
          this.SetRequired({
            attrName: "总预计工期(工作日)",
            formkey: "4691-100013712",
            reqName: "empty",
            reqStatus: false,
          });
        }
        this.formData["4691-100013720"].value = " ";
      }
      if (this.formData["4691-100013717"].value == "9005002") {
        this.formData["4691-141000051"].text = "不具备";
        this.formData["4691-141000051"].value = "9005002";
        this.SetRequired({
          attrName: "预计工期(工作日)",
          formkey: "4691-100013720",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "总预计工期(工作日)",
          formkey: "4691-100013712",
          reqName: "empty",
          reqStatus: true,
        });
      }
    },

    //长途中继资源预计工作日
    TIMELIMITB() {
      this.SetRequired({
        attrName: "预计工期(工作日)",
        formkey: "4691-100013720",
        reqName: "pinteger",
        reqStatus: true,
      });
      if (this.formData["4691-100013717"].value == "9005001") {
        if (this.formData["4691-100013720"].value > 20) {
          this.$alert("预计工作日不能超过20天!", "提示", {
            type: "warning",
            confirmButtonText: "关闭",
          });
          this.formData["4691-100013720"].value = "";
        }
      }
    },

    //电路维护等级是否具备当具备时，可提供电路维护等级字段隐藏
    CircuitLevel() {
      if (this.formData["10461702-100012783"].value == "9005001") {
        this.formData["10461702-100012749"].isshow = false;
      }
      if (this.formData["10461702-100012783"].value == "9005002") {
        this.formData["10461702-100012749"].isshow = true;
      }
    },
  },
};
</script>

